package com.lagou.work02;

/**
 * 测试类
 */
public class Code03Test {
    public static void main(String[] args) {
        System.out.println("--------注册卡--------");
        // 定义通话套餐数量与资费
        Code03PhonePackage call = new Code03PhonePackage(1, 0, 0);
        // 定义上网套餐与资费
        Code03NetworkPackage network = new Code03NetworkPackage(1, 0);
        // 创建消费统计对象
        Code03UserConsume consume = new Code03UserConsume();
        // 注册一张手机卡，枚举手机卡类型：大卡
        Code03PhoneCard card = new Code03PhoneCard(Code03CardTypeEnum.BIG.getCardType(), "13355557777",
                "username", "******", 1000, call.getPhonePackage(), network.getPhonePackage(), consume);
        // 多态：打印套餐信息：抽象套餐类->通话套餐、上网套餐
        card.showOnCreate(call, network);
        System.out.println("----------------\n\n");

        // 开始消费
        System.out.println("--------使用通话--------");
        call.server(20, card);
        System.out.println("\n-------------\n\n");

        System.out.println("--------使用流量--------");
        network.server(200, card);
        System.out.println("\n---------------\n\n");

    }
}
